let arr = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]
let removeRepeat = (arr) => {
    arr.sort((a, b) => a - b)
    let [fast, slow] = [0, 0];
    while (fast < arr.length) {
        if (arr[fast] !== arr[slow]) {
            slow++;
            arr[slow] = arr[fast]
        }
        fast++;
    }
    return arr.slice(0, slow + 1);
}
console.log(removeRepeat(arr))